package com.term.domain.utils;

import com.term.domain.enums.SplitTypeEnums;

import java.util.Collection;
import java.util.List;

/**
 * Created by chenGang on 2017/1/5.
 */
public class StitchingSqlTool {

    public static <E, T extends Collection<E>> String joinCollection(T t, SplitTypeEnums splitType) {
        StringBuffer stringBuffer = new StringBuffer();
        Boolean isFirst = true;

        for (E e : t) {
            if (isFirst) {
                stringBuffer.append(e.toString());
                isFirst = false;
            } else {
                stringBuffer.append(splitType.getValue() + e.toString());
            }
        }
        return stringBuffer.toString();
    }
}
